# Copyright 2023 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//build_tools/bazel:build_defs.oss.bzl", "iree_runtime_cc_library", "iree_runtime_cc_test")

package(
    default_visibility = ["//visibility:public"],
    features = ["layering_check"],
    licenses = ["notice"],  # Apache 2.0
)

iree_runtime_cc_library(
    name = "irpa",
    srcs = [
        "irpa_builder.c",
        "irpa_parser.c",
    ],
    hdrs = [
        "irpa_builder.h",
        "irpa_parser.h",
    ],
    deps = [
        "//runtime/src/iree/base",
        "//runtime/src/iree/io:file_handle",
        "//runtime/src/iree/io:parameter_index",
        "//runtime/src/iree/io:stream",
        "//runtime/src/iree/schemas:parameter_archive",
    ],
)

iree_runtime_cc_test(
    name = "irpa_parser_test",
    srcs = ["irpa_parser_test.cc"],
    tags = ["requires-filesystem"],
    deps = [
        ":irpa",
        "//runtime/src/iree/io/formats/irpa/testdata:irpa_files",
        "//runtime/src/iree/testing:gtest",
        "//runtime/src/iree/testing:gtest_main",
    ],
)
